<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>attrbutes</title>
</head>
<body>
<div id="d1" align="center" class="abc">Hello HTML</div>
<script>
    var div = document.getElementById("d1").attributes;
    for(var i=0;i<div.length;i++){
        document.write(div[i].nodeName);
        document.write(":");
        document.write(div[i].nodeValue+"<br />")
    }

</script>

</body>
</html>